import 'package:flutter/material.dart';

class NewsDetailPage extends StatefulWidget {
  const NewsDetailPage({super.key});

  @override
  State<NewsDetailPage> createState() => _NewsDetailPageState();
}

class _NewsDetailPageState extends State<NewsDetailPage> {
  Color _titleColor = Color.fromRGBO(0, 55, 100, 1);
  bool goods = false;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        elevation: 0,
        foregroundColor: _titleColor,
        backgroundColor: Colors.white,
        actions: const [
          Center(
              child: Text(
            'news',
            style: TextStyle(color: Colors.black),
          )),
          SizedBox(
            width: 20,
          )
        ],
      ),
      body: Container(
        margin: EdgeInsets.symmetric(horizontal: 20),
        child: ListView(
          children: [
            SizedBox(height: 20,),
            titleContainer('Skills Change Worlds'),
            textContainer(
                "We've taken everything our Members shared with us in our first ever global Impact Survey and gathered impact stories that demonstrate how skills change worlds."),
            Container(
              child: ClipRRect(
                  borderRadius: BorderRadius.circular(25),
                  child: Image(
                image: AssetImage('images/newsbgc.png'),
              )),
            ),
            textContainer('Confident learners. Ambitious individuals. Inclusive workplaces. Productive businesses. Sustainable industries. Economic growth.'),
            textContainer('Skills help all these things thrive, which is why we need more skilled young people.'),
            textContainer('Today WorldSkills is celebrating the positive impact that the young people, educators, governments,and partners in the WorldSkills community are all having because of skills.'),
            textContainer("We've taken everything our Members shared with us and gathered impact stories that demonstrate how skills change worlds.Our impact can be summed up in these five Impact Statements:"),
            textContainer('-WorldSkills increase the number of skilled young people \n-Worldskills improves standards of vocational training for all \n-Worldskills prepares young people for their future careers \n-WorldSkills contributes to the success of industries \n-WorldSkills improves economic growth and human development'),
            textContainer('Over the coming months,we will share more of our impact with you.For now,you can watch our Impact film,read our Impact Stories,and download our Impact Report.'),

            GestureDetector(
              onTap: (){
                setState(() {
                  goods = !goods;
                });
              },
              child: Container(
                child: Image(
                  width: 30,
                  height: 30,
                  image: AssetImage(goods == false ? 'images/good.png' : 'images/good1.png'),
                ),
              ),
            ),
            SizedBox(height: 20,),
          ],
        ),
      ),
    );
  }

  Container textContainer(contect) {
    String text = contect;
    return Container(
        margin: EdgeInsets.symmetric(vertical: 10), child: Text(text,style: TextStyle(fontSize: 16),));
  }

  Container titleContainer(contect) {
    String text = contect;

    return Container(
      margin: EdgeInsets.symmetric(vertical: 10),
      child: Text(
        text,
        style: TextStyle(
            color: _titleColor, fontSize: 24, fontWeight: FontWeight.w800),
      ),
    );
  }
}
